﻿// -------------------------------------------------------------------------
//    @FileName         :    NFTransBatchSimpleBase.cpp
//    @Author           :    gaoyi
//    @Date             :    2025-03-27
//    @Email			:    445267987@qq.com
//    @Module           :    NFTransBatchSimpleBase
//
// -------------------------------------------------------------------------

#include "NFTransBatchSimpleBase.h"

#include "NFSnsRoleSimple.h"
#include "NFTransLoadRoleSimple.h"
#include "NFServerComm/NFServerCommon/NFCacheDataMgr.h"

NFTransBatchSimpleBase::NFTransBatchSimpleBase()
{
    if (NFShmMgr::Instance()->GetCreateMode() == EN_OBJ_MODE_INIT)
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFTransBatchSimpleBase::~NFTransBatchSimpleBase()
{
}

int NFTransBatchSimpleBase::CreateInit()
{
    return 0;
}

int NFTransBatchSimpleBase::ResumeInit()
{
    return 0;
}

int NFTransBatchSimpleBase::GetCacheDataRes(int ullId, int iTableId, int iReason, int32_t errCode, google::protobuf::Message* pMessage)
{
    if (errCode == 0)
    {
        proto_ff::tbSnsRoleSimpleInfo* pTbSnsRoleSimple = dynamic_cast<proto_ff::tbSnsRoleSimpleInfo*>(pMessage);
        CHECK_NULL_WF(m_ullRoleId, pTbSnsRoleSimple, "dynamic_cast<tbSnsRoleSimpleInfo> failed, roleId:{}", ullId);

        auto pSnsRoleSimple = NFCacheDataMgr::Instance()->AddCacheData<NFSnsRoleSimple>(pTbSnsRoleSimple);
        CHECK_NULL_WF(m_ullRoleId, pSnsRoleSimple, "AddCacheData failed, roleId:{}", ullId);
    }

    return 0;
}
